/*******************************************************************************
 * Header file for Homework 4 Main class.
 * Author: Andrew Shore
 * Date last modified: 1 March 2010
 * 
 * Class constants:
 * ROWS - enumerated constant for the maximum number of rows for the 
          2 dimensional array of characters words
 * COLUMNS - enumerated constant for the maximum number of columns of words
 * RIGHT - enumerated constant to signify traversing right along the array
 *         (adding 1 to the column)
 * LEFT - enumerated constant to signify traversing left along the array
 *        (subtracting 1 from the column)
 * UP - enumerated constant to signify traversing up along the array
 *      (subtracting 1 from rows)
 * DOWN - enumerated constant to signify travesing down along the array
 *        (adding 1 to the row)
 * ZERO - enumerated constant to signify no change in either the row or the 
 *        column
 * 
 * Class Variables:
 * char words[][] - character array 
 * rowCount - number of rows in the wordsearch puzzle, read from input file
 * colCount - number of columns in the wordsearch puzzle
 * displayArr[][] - array full of asterisks used to display word once it is
                    found
 *
 * Full documentation is in the implementation file.
*******************************************************************************/ 



#include "Utils.h"
#include <cstring>
#include <vector>

using namespace std;

class Wordsearch{

public:

  Wordsearch();
  virtual ~Wordsearch();

  void initialize(ifstream& arrInFile, ifstream& wordsInFile,
                  ofstream& outFile);
  
private:

  enum {ROWS = 50};
  enum {COLUMNS = 50};
  enum {RIGHT = 1};
  enum {LEFT = -1};
  enum {UP = -1};
  enum {DOWN = 1};
  enum {ZERO = 0};

  char letters[ROWS][COLUMNS];
  char displayArr[ROWS][COLUMNS];
  int rowCount;
  int colCount;
 
  //mutators
  void setRowCount(int rows);
  void setColCount(int cols);
  
  //General Functions
  bool findFirstLetter(string searchWord, ofstream& outFile);
  bool search(string searchWord, int horInc, int vertInc,
              int currentRow, int currentCol);
  void display(string searchWord, int horInc, int vertInc,
               int currentRow, int currentCol, ofstream& outFile);
  void readArray(ifstream& arrIn, ofstream& outFile);
  void readWords(ifstream& wordsIn, ofstream& outFile);
  void setDisplayArray();
  
};
